#ifndef WRITER_H
#define WRITER_H

#include <QObject>
#include <QNetworkReply>

class QFile;

class Writer : public QObject
{
    Q_OBJECT

public:
    Writer(QFile* file, QObject* parent = nullptr);
    ~Writer();

    void setReply(QNetworkReply* reply);

signals:
    void newDataDownloaded(qint64 bytes);

private slots:
    void bytesAvailable();

private:
    QFile* file;
    qint64 downloaded;      // number of bytes downloaded
    QNetworkReply* reply;       // reply object
};

#endif // WRITER_H
